home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / Goodies Disk / Glypha.src / Code ƒ / F-GlyphaGuts.p < prev    next >
Encoding:
Text File  |  1991-02-06  |  18.6 KB  |  695 lines  |  [TEXT/PJMM]

  1. {This code was written by John Calhoun of Soft Dorothy Software.  Code is ©1990 john calhoun}
  2. {Feel free to read over the code, learn from it, etc.}
  3. {If the code helps you or if you borrow portions of it, please send $15 to:}
  4. {john calhoun}
  5. {1201 Oread #4}
  6. {Lawrence, KS 66044}
  7. {So long as this header remains, feel free to distribute this code.}
  8.  
  9. unit GlyphaGuts;
  10.  
  11. interface
  12.     uses
  13.         Dialogs, Sound, Enemies, GameUtils;
  14.  
  15.     procedure DoAStoneHit (whichStone: Rect);
  16.     procedure MoveThePlayer;
  17.     procedure CheckTombStones;
  18.     procedure AnimateTheAnk;
  19.     procedure AdvanceALevel;
  20.     procedure EnterANewMortal;
  21.     procedure DoEnd;
  22.     procedure ExitAMortal;
  23.     procedure SlideTheStones;
  24.  
  25. implementation
  26.  
  27. {=================================}
  28.  
  29.     procedure DoOnTheGround;
  30.         var
  31.             onLand: Boolean;
  32.             index: Integer;
  33.             tempRect, dummyRect: Rect;
  34.     begin
  35.         with thePlayer do
  36.             begin
  37.                 if (state) then        {taking off from the ground}
  38.                     begin
  39.                         DoTheSound('flap.snd', TRUE);
  40.                         state := FALSE;
  41.                         mode := 5;
  42.                         ChangeRect;
  43.                         vertVel := liftAmount;
  44.                     end
  45.                 else                            {but if not flapping...}
  46.                     begin
  47.                         onLand := FALSE;
  48.                         tempRect := dest;
  49.                         InsetRect(tempRect, 17, 0);
  50.                         OffsetRect(tempRect, 0, 2);
  51.                         for index := startStone to numberOfStones do
  52.                             if (SectRect(tombRects[index], tempRect, dummyRect)) then
  53.                                 onLand := TRUE;
  54.                         if not onLand then
  55.                             begin
  56.                                 mode := 4;
  57.                                 ChangeRect;
  58.                                 vertVel := fallAmount;
  59.                             end
  60.                         else                            {on solid ground}
  61.                             begin
  62.                                 if (keyStillDown) then    {and running}
  63.                                     begin
  64.                                         horiVel := running[horiVel, facing, 0];
  65.                                         mode := running[horiVel, facing, 1];
  66.                                         if ((mode = 0) or (mode = 2)) then
  67.                                             DoTheSound('walk.snd', TRUE);
  68.                                     end
  69.                                 else                            {not running, we're braking - screeeech}
  70.                                     begin
  71.                                         mode := 1;
  72.                                         horiVel := idleLanded[horiVel];
  73.                                         if (horiVel <> 0) then
  74.                                             DoTheSound('screech.snd', TRUE);
  75.                                     end;                        {end - else, key still down}
  76.                             end;                            {end - else, not on solid ground}
  77.                     end;                                {end - else, not flapping to take off}
  78.                 dest.left := dest.left + horiVel;
  79.                 dest.right := dest.right + horiVel;
  80.                 dest.top := dest.top + vertVel;
  81.                 dest.bottom := dest.bottom + vertVel;
  82.             end;
  83.     end;
  84.  
  85. {=================================}
  86.  
  87.     procedure DoAStoneHit;
  88.     begin
  89.         with thePlayer do
  90.             begin
  91.                 if (horiVel > 0) then
  92.                     begin
  93.                         if (dest.left < whichStone.left) then    {hit the edge}
  94.                             begin
  95.                                 dest.left := dest.left + whichStone.left - whichStone.right;
  96.                                 dest.right := dest.right + whichStone.left - whichStone.right;
  97.                                 horiVel := impacted[horiVel];
  98.                             end
  99.                         else
  100.                             begin
  101.                                 if (vertVel < 0) then                            {hit coming up}
  102.                                     begin
  103.                                         vertVel := impacted[vertVel];
  104.                                         OffsetRect(dest, 0, whichStone.bottom - dest.top);
  105.                                     end
  106.                                 else
  107.                                     begin
  108.                                         if (mode = 6) then
  109.                                             begin
  110.                                                 DoTheSound('boom1.snd', TRUE);
  111.                                                 OffsetRect(dest, 0, whichStone.top - dest.bottom);
  112.                                                 vertVel := 0;
  113.                                                 horiVel := 0;
  114.                                                 mode := 50;
  115.                                                 ChangeRect;
  116.                                                 Exit(DoAStoneHit);
  117.                                             end;
  118.                                         if (vertVel < 4) or (dest.right > whichStone.right) then
  119.                                             begin
  120.                                                 DoTheSound('screech.snd', TRUE);
  121.                                                 vertVel := -3;
  122.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom);
  123.                                             end
  124.                                         else
  125.                                             begin
  126.                                                 DoTheSound('walk.snd', TRUE);
  127.                                                 vertVel := 0;
  128.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom - 10);
  129.                                                 mode := 1;
  130.                                                 ChangeRect;
  131.                                             end;
  132.                                     end;
  133.                             end;
  134.                     end
  135.                 else
  136.                     begin
  137.                         if (dest.right > whichStone.right) then    {hit the edge}
  138.                             begin
  139.                                 OffsetRect(dest, whichStone.right - whichStone.left, 0);
  140.                                 horiVel := impacted[horiVel];
  141.                             end
  142.                         else
  143.                             begin
  144.                                 if (vertVel < 0) then        {hit coming up}
  145.                                     begin
  146.                                         vertVel := impacted[vertVel];
  147.                                         OffsetRect(dest, 0, whichStone.bottom - dest.top);
  148.                                     end
  149.                                 else
  150.                                     begin
  151.                                         if (mode = 6) then
  152.                                             begin
  153.                                                 DoTheSound('boom1.snd', TRUE);
  154.                                                 OffsetRect(dest, 0, whichStone.top - dest.bottom);
  155.                                                 vertVel := 0;
  156.                                                 horiVel := 0;
  157.                                                 if (mortals <= 1) then
  158.                                                     mode := 7
  159.                                                 else
  160.                                                     mode := 50;
  161.                                                 ChangeRect;
  162.                                                 Exit(DoAStoneHit);
  163.                                             end;
  164.                                         if (vertVel < 4) or (dest.left < whichStone.left) then
  165.                                             begin
  166.                                                 DoTheSound('screech.snd', TRUE);
  167.                                                 vertVel := -3;
  168.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom);
  169.                                             end
  170.                                         else
  171.                                             begin
  172.                                                 DoTheSound('walk.snd', TRUE);
  173.                                                 vertVel := 0;
  174.                                                 OffSetRect(dest, 0, whichStone.top - dest.bottom - 10);
  175.                                                 mode := 1;
  176.                                                 ChangeRect;
  177.                                             end;
  178.                                     end;
  179.                             end;
  180.                     end;
  181.             end;
  182.     end;
  183.  
  184. {=================================}
  185.  
  186.     procedure DoInTheAir;
  187.         var
  188.             index: Integer;
  189.             tempRect, dummyRect: Rect;
  190.     begin
  191.         with thePlayer do
  192.             begin
  193.                 if (keyStillDown) then
  194.                     horiVel := gliding[horiVel, facing];
  195.                 if (state) then
  196.                     begin
  197.                         DoTheSound('flap.snd', TRUE);
  198.                         mode := 5;
  199.                         state := FALSE;
  200.                         vertVel := vertVel + liftAmount;
  201.                     end
  202.                 else
  203.                     begin
  204.                         if (vertVel < maxFall) then
  205.                             vertVel := vertVel + fallAmount;
  206.                         if (vertVel > 0) then
  207.                             mode := 4
  208.                         else
  209.                             mode := 5;
  210.                     end;
  211.                 dest.left := dest.left + horiVel;
  212.                 dest.right := dest.right + horiVel;
  213.                 dest.top := dest.top + vertVel;
  214.                 dest.bottom := dest.bottom + vertVel;
  215.                 for index := startStone to numberOfStones do
  216.                     begin
  217.                         if SectRect(dest, tombRects[index], dummyRect) then
  218.                             DoAStoneHit(dummyRect);
  219.                     end;
  220.             end;
  221.     end;
  222.  
  223. {=================================}
  224.  
  225.     procedure DoFallingSkeleton;
  226.         var
  227.             index: Integer;
  228.             dummyRect: Rect;
  229.     begin
  230.         with thePlayer do
  231.             begin
  232.                 if (vertVel < maxFall) then
  233.                     vertVel := vertVel + fallAmount;
  234.                 dest.left := dest.left + horiVel;
  235.                 dest.right := dest.right + horiVel;
  236.                 dest.top := dest.top + vertVel;
  237.                 dest.bottom := dest.bottom + vertVel;
  238.                 for index := startStone to numberOfStones do
  239.                     begin
  240.                         if SectRect(dest, tombRects[index], dummyRect) then
  241.                             DoAStoneHit(dummyRect);
  242.                     end;
  243.             end;
  244.     end;
  245.  
  246. {=================================}
  247.  
  248.     procedure DoDeadBones;
  249.     begin
  250.         with thePlayer do
  251.             begin
  252.                 if (mode < 8) then
  253.                     begin
  254.                         OffsetRect(dest, 0, 1);
  255.                         dest.bottom := dest.bottom - 1;
  256.                         if (dest.bottom = dest.top) then
  257.                             begin
  258.                                 deadAndGone := TRUE;
  259.                                 CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, playRgn);
  260.                             end;
  261.                     end
  262.                 else
  263.                     mode := mode - 1;
  264.             end;
  265.     end;
  266.  
  267. {=================================}
  268.  
  269.     procedure MoveThePlayer;
  270.  
  271.     begin
  272.         case thePlayer.mode of
  273.             0..3: 
  274.                 begin
  275.                     DoOnTheGround;
  276.                     CheckTombStones;
  277.                 end;
  278.             4..5: 
  279.                 begin
  280.                     DoInTheAir;
  281.                     CheckTombStones;
  282.                 end;
  283.             6: 
  284.                 begin
  285.                     DoFallingSkeleton;
  286.                     CheckTombStones;
  287.                 end;
  288.             7..100: 
  289.                 DoDeadBones;
  290.         end;
  291.     end;
  292.  
  293. {=================================}
  294.  
  295.     procedure CheckTombStones;
  296.         var
  297.             hori, vert: Integer;
  298.             dummyRect: Rect;
  299.     begin
  300.         with thePlayer do
  301.             begin
  302.                 if (not SectRect(dest, playRect, dummyRect)) then    {Player has left the screen    }
  303.                     begin
  304.                         if (dest.top > playRect.bottom) then
  305.                             begin
  306.                                 if (otherState) then
  307.                                     begin
  308.                                         OffsetRect(dest, 0, 1);
  309.                                         if (dest.top > playRect.bottom + 10) then
  310.                                             deadAndGone := TRUE;
  311.                                         Exit(CheckTombStones);
  312.                                     end
  313.                                 else
  314.                                     begin
  315.                                         DoTheSound('bird.snd', TRUE);
  316.                                         OffsetRect(dest, 0, playRect.bottom - dest.top + 1);
  317.                                         otherState := TRUE;
  318.                                         Exit(CheckTombStones);
  319.                                     end;
  320.                             end
  321.                         else
  322.                             begin
  323.                                 if (dest.bottom <= playRect.top) then
  324.                                     begin
  325.                                         vertVel := impacted[vertVel];
  326.                                         OffSetRect(dest, 0, playRect.top - dest.bottom + 1);
  327.                                     end
  328.                                 else
  329.                                     begin
  330.                                         if (dest.right < playRect.left) then
  331.                                             begin
  332.                                                 CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, playRgn);
  333.                                                 OffsetRect(dest, 511, 0);
  334.                                                 oldDest := dest;
  335.                                             end
  336.                                         else
  337.                                             begin
  338.                                                 if (dest.left > playRect.right) then
  339.                                                     begin
  340.                                                         CopyBits(offVirginMap, mainWndo^.portBits, oldDest, oldDest, srcCopy, playRgn);
  341.                                                         OffsetRect(dest, -511, 0);
  342.                                                         oldDest := dest;
  343.                                                     end;
  344.                                             end;
  345.                                     end;
  346.                             end;
  347.                     end;
  348.             end;
  349.     end;
  350.  
  351. {=================================}
  352.  
  353.     procedure AnimateTheAnk;
  354.         var
  355.             index, index2, howHigh: Integer;
  356.             dummyLong: LongInt;
  357.             newRect, tempRect: Rect;
  358.             theEvent: EventRecord;
  359.     begin
  360.         DoTheSound('lightning.snd', TRUE);
  361.         if ((numberOfStones > 4) and (DoRandom(2) = 0) and (not stonesSliding)) then
  362.             begin
  363.                 SetRect(newRect, 247, 121, 263, 145);
  364.                 howHigh := upperLevel;
  365.                 OffsetRect(thePlayer.dest, 0, -172);
  366.                 thePlayer.oldDest := thePlayer.dest;
  367.             end
  368.         else
  369.             begin
  370.                 SetRect(newRect, 247, 292, 263, 316);
  371.                 howHigh := lowerLevel;
  372.             end;
  373.         CopyMask(offPlayerMap, offPlayerMap, mainWndo^.portBits, ankRects[0, source], ankRects[0, mask], newRect);
  374.         StrikeLightning(howHigh);
  375.         StrikeLightning(howHigh);
  376.         StrikeLightning(howHigh);
  377.  
  378.         tempRect := thePlayer.dest;
  379.         FlushEvents(everyEvent, 0);
  380.         lastLoopTime := TickCount;
  381.  
  382.         for index := 0 to 60 do        {Here's where the player flashes in get-ready mode    }
  383.             begin
  384.                 DoTheSound('rez.snd', TRUE);
  385.                 CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil);
  386.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, ankRects[0, source], ankRects[0, mask], newRect);
  387.                 CopyBits(offLoadMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, nil);
  388.                 if (stonesSliding) then
  389.                     SlideTheStones;
  390.                 UpdateEye;
  391.                 HandleTheEnemies;
  392.                 DrawBeasts;
  393.                 CopyBits(offVirginMap, offLoadMap, newRect, newRect, srcCopy, nil);
  394.                 CopyMask(offPlayerMap, offPlayerMap, offLoadMap, playerRects[0, 1], playerRects[2, 1], tempRect);
  395.                 CopyBits(offLoadMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, nil);
  396.                 if (EventAvail(playMask, theEvent) or Button) then
  397.                     begin
  398.                         if ((theEvent.what = MouseDown) or (theEvent.what = keyDown) or Button) then
  399.                             begin
  400.                                 thePlayer.otherState := FALSE;
  401.                                 Exit(AnimateTheAnk);
  402.                             end;
  403.                     end;
  404.                 if (stonesSliding) then
  405.                     SlideTheStones;
  406.                 UpdateEye;
  407.                 HandleTheEnemies;
  408.                 if (theHand.state) then
  409.                     RetractTheHand;
  410.                 DrawBeasts;
  411.             end;
  412.     end;
  413.  
  414. {=================================}
  415.  
  416.     procedure AdvanceALevel;
  417.         var
  418.             index, aNumber, anotherNumber: Integer;
  419.     begin
  420.         if (score > 0) then                        {Compute the time bonus (if any) to the score.    }
  421.             aNumber := 2000 - gameCycle        {If they cleared it in less than 2000 cycles        }
  422.         else
  423.             aNumber := 0;
  424.         if (aNumber < 0) then                    {But don't SUBTRACT from their score, even    }
  425.             aNumber := 0;                            {if they took forever.  Just add zero.}
  426.         score := score + aNumber;                {Add it...                                                }
  427.         CheckExtraMortal;
  428.         oldScore := Score;                            {Keep a hold on this score.                }
  429.         levelOn := levelOn + 1;
  430.  
  431.         if (levelOn = 3) then
  432.             stonesSliding := TRUE
  433.         else
  434.             stonesSliding := FALSE;
  435.         DoTheHoopla;
  436.  
  437.         with theEye do
  438.             begin
  439.                 otherMode := 0;
  440.                 mode := (levelOn * 10) - 1500;
  441.                 if (mode > -100) then
  442.                     mode := -100;
  443.                 dest := eyeRects[4];
  444.                 OffsetRect(dest, -43, 70);
  445.                 if (DoRandom(2) = 0) then
  446.                     OffsetRect(dest, 0, 100);
  447.                 oldDest := dest;
  448.             end;
  449.  
  450.         beastsActive := 0;
  451.         beastsKilled := 0;
  452.  
  453.         if ((levelOn div 5) = (levelOn / 5)) then
  454.             begin                                {Every fifth wave is an egg wave!!}
  455.                 if (onFastMachine) then
  456.                     begin
  457.                         totalToKill := 8;                {In "slow mode" we assume they are on a MacII    }
  458.                         numberOfEnemies := 8;        {so we give them nine eggs to clear.                    }
  459.                         beastsActive := 8;
  460.                     end
  461.                 else
  462.                     begin
  463.                         totalToKill := 6;                {In fast mode we only give them 6.  Nine would    }
  464.                         numberOfEnemies := 6;        {be slow the machine down too much.                }
  465.                         beastsActive := 6;
  466.                     end;
  467.                 for index := 1 to numberOfEnemies do
  468.                     with theEnemies[index] do
  469.                         begin
  470.                             mode := -DoRandom(300) + levelOn;
  471.                             if (mode > -100) then
  472.                                 mode := DoRandom(50) - 150;
  473.                             otherState := TRUE;
  474.                             facing := DoRandom(2);
  475.                             aNumber := DoRandom(2);                    {Now we figure out where the sphinx is    }
  476.                             anotherNumber := DoRandom(100) + 10;    {to appear.  What platform, what side.    }
  477.                             if (facing = 0) then
  478.                                 begin
  479.                                     if aNumber = 0 then
  480.                                         SetRect(dest, anotherNumber, 74, 22 + anotherNumber, 96)
  481.                                     else
  482.                                         SetRect(dest, anotherNumber, 190, 22 + anotherNumber, 212);
  483.                                 end
  484.                             else
  485.                                 begin
  486.                                     if aNumber = 0 then
  487.                                         SetRect(dest, 400 + anotherNumber, 74, 422 + anotherNumber, 96)
  488.                                     else
  489.                                         SetRect(dest, 400 + anotherNumber, 190, 422 + anotherNumber, 212);
  490.                                 end;
  491.                             oldDest := dest;
  492.                         end;
  493.             end
  494.         else
  495.             begin            {a normal 'non-egg' wave}
  496.                 totalToKill := levelOn div 5 + 4;
  497.                 numberOfEnemies := levelOn div 5 + 1;
  498.                 if ((numberOfEnemies > 3) and (not onFastMachine)) then
  499.                     numberOfEnemies := 3
  500.                 else if (numberOfEnemies > 5) then
  501.                     numberOfEnemies := 5;
  502.                 for index := 1 to numberOfEnemies do
  503.                     with theEnemies[index] do
  504.                         begin
  505.                             mode := 150 + DoRandom(100);
  506.                             DoEnemyPlacement(index);
  507.                         end;
  508.             end;
  509.  
  510.         for index := 1 to numberOfEnemies do
  511.             with theEnemies[index] do
  512.                 begin
  513.                     state := FALSE;
  514.                     aNumber := DoRandom(levelOn);    {What type of sphinx?  O, 1 or 2?  Well, on level 1,    }
  515.                     if (aNumber > 20) then                {there is a 0% chance that a random # between 0 &    }
  516.                         otherMode := 2                            {0 will be greater than 20...so, no tough sphinx.        }
  517.                     else                                                    {But on level 30, aNumber will be a random number    }
  518.                         begin                                                {between 0 and 29.  That gives us almost a 33%        }
  519.                             if (aNumber > 10) then        {chance that it will be a sphinx 2, if not a sphinx 2,    }
  520.                                 otherMode := 1                    {(not >20) then a good 50% chance that aNumber>10    }
  521.                             else                                            {(11 to 20) and thus a sphinx 1.  Note: there is        }
  522.                                 otherMode := 0;                    {ALWAYS a CHANCE of the easiest sphinx 0, but it    }
  523.                         end;                                                {gets increasingly unlikely as the player goes on.        }
  524.                     vertVel := 0;
  525.                     horiVel := 0;
  526.                 end;
  527.  
  528.         with theHand do
  529.             begin
  530.                 dest := handRects[source, 0];
  531.                 OffsetRect(dest, 100, 270);
  532.                 oldDest := dest;
  533.                 state := FALSE;
  534.                 onward := FALSE;
  535.                 mode := 0;
  536.             end;
  537.  
  538.         growRate := levelOn div 3 + 1;
  539.         if (growRate > 8) then
  540.             growRate := 8;
  541.         numberOfStones := 2;
  542.         startStone := 0;
  543.         if (levelOn < 3) then
  544.             tombRects[0] := tombRects[-1]
  545.         else
  546.             tombRects[0] := tombRects[-2];
  547.  
  548.         if (levelOn = 3) then
  549.             begin
  550.                 tombRects[5] := tombRects[-4];
  551.                 numberOfStones := numberOfStones + 2;
  552.             end
  553.         else
  554.             tombRects[5] := tombRects[-3];
  555.  
  556.         if (((levelOn + 4) / 5) = ((levelOn + 4) div 5)) then
  557.             numberOfStones := numberOfStones + 3;
  558.         if ((levelOn / 5) = (levelOn div 5)) then
  559.             numberOfStones := numberOfStones + 3;
  560.         if (((levelOn + 3) / 5) = ((levelOn + 3) div 5)) then
  561.             numberOfStones := numberOfStones + 2;
  562.         if (((levelOn + 2) / 5) = ((levelOn + 2) div 5)) then
  563.             numberOfStones := numberOfStones + 2;
  564.         RedoTheBackground;
  565.         gameCycle := 0;
  566.         FlushEvents(everyEvent, 0);
  567.     end;
  568.  
  569. {=================================}
  570.  
  571.     procedure EnterANewMortal;
  572.     begin
  573.         with thePlayer do
  574.             begin
  575.                 facing := 0;
  576.                 mode := 0;
  577.                 horiVel := 0;
  578.                 vertVel := 0;
  579.                 dest := absoluteRects[facing, mode];
  580.                 OffSetRect(dest, 238, 267);
  581.                 oldDest := dest;
  582.                 if (theEye.mode > 0) then
  583.                     theEye.mode := 272;
  584.                 state := FALSE;
  585.             end;
  586.         keyStillDown := FALSE;
  587.         playing := TRUE;
  588.         pausing := FALSE;
  589.         deadAndGone := FALSE;
  590.         AnimateTheAnk;
  591.     end;
  592.  
  593. {===================================}
  594.  
  595.     procedure DoEnd;
  596.         var
  597.             index: Integer;
  598.             dummyLong: LongInt;
  599.             tempRect: Rect;
  600.     begin
  601.         DoTheSound('music.snd', FALSE);                    {Play the theme song, but wait for it to finish    }
  602.         playing := FALSE;
  603.         pausing := FALSE;
  604.         RedoTheBackground;
  605.         ShowScore;
  606.         tempRect := gameoverRects[0];
  607.         OffsetRect(tempRect, -105, -100);
  608.         for index := 1 to 5 do
  609.             begin
  610.                 CopyMask(offPlayerMap, offPlayerMap, mainWndo^.portBits, gameoverRects[1], gameoverRects[1], tempRect);
  611.                 Delay(4, dummyLong);
  612.                 CopyMask(offPlayerMap, offPlayerMap, mainWndo^.portBits, gameoverRects[0], gameoverRects[1], tempRect);
  613.                 Delay(4, dummyLong);
  614.             end;
  615.  
  616.         with theEye do
  617.             begin
  618.                 dest := eyeRects[4];
  619.                 OffsetRect(dest, -43, 70);
  620.                 oldDest := dest;
  621.             end;
  622.  
  623.         Delay(120, dummyLong);
  624.  
  625.         InitCursor;
  626.         FinalScore;
  627.         RedoTheBackground;
  628.         SetEventMask(EveryEvent);
  629.         RedrawHiScores;
  630.         if (downOffset < 20) then
  631.             begin
  632.                 InsertMenu(AppleMenu, 0);        {Insert this menu into the menu bar}
  633.                 InsertMenu(GameMenu, 0);        {Insert this menu into the menu bar}
  634.                 InsertMenu(OptionsMenu, 0);    {Insert this menu into the menu bar}
  635.                 DrawMenuBar;                    {Draw the menu bar}
  636.                 FlashMenuBar(0);
  637.             end;
  638.     end;
  639.  
  640. {=================================}
  641.  
  642.     procedure ExitAMortal;
  643.         var
  644.             aNumber: Integer;
  645.     begin
  646.         mortals := mortals - 1;
  647.         UnionRect(thePlayer.oldDest, thePlayer.dest, thePlayer.wholeRect);
  648.         CopyBits(offVirginMap, mainWndo^.portBits, thePlayer.wholeRect, thePlayer.wholeRect, srcCopy, playRgn);
  649.         if (mortals <= 0) then                            {Game over, dude}
  650.             begin
  651.                 DoEnd;
  652.             end
  653.         else
  654.             begin
  655.                 EnterANewMortal;
  656.             end;
  657.     end;
  658.  
  659. {=================================}
  660.  
  661.     procedure SlideTheStones;
  662.         var
  663.             oldStone1, oldStone2, newStone1, newStone2, stoneSrc: Rect;
  664.     begin
  665.         SetRect(stoneSrc, 166, 316, 346, 332);
  666.         oldStone1 := stoneSrc;
  667.         oldStone2 := stoneSrc;
  668.         OffsetRect(tombRects[5], 1, 0);
  669.         OffsetRect(tombRects[6], -1, 0);
  670.         OffsetRect(oldStone1, tombRects[5].left - stoneSrc.left, 0);
  671.         OffsetRect(oldStone2, tombRects[6].right - stoneSrc.right, 0);
  672.         newStone1 := oldStone1;
  673.         newStone2 := oldStone2;
  674.         oldStone1.left := oldStone1.left - 1;
  675.         oldStone2.right := oldStone2.right + 1;
  676.  
  677.         CopyBits(offVirginMap, offLoadMap, oldStone1, oldStone1, srcCopy, nil);
  678.         CopyBits(offVirginMap, offLoadMap, oldStone2, oldStone2, srcCopy, nil);
  679.         CopyBits(offVirginMap, offLoadMap, stoneSrc, newStone1, srcCopy, nil);
  680.         CopyBits(offVirginMap, offLoadMap, stoneSrc, newStone2, srcCopy, nil);
  681.         CopyBits(offLoadMap, mainWndo^.portBits, oldStone1, oldStone1, srcCopy, playRgn);
  682.         CopyBits(offLoadMap, mainWndo^.portBits, oldStone2, oldStone2, srcCopy, playRgn);
  683.  
  684.         if (oldStone2.right < 0) then
  685.             begin
  686.                 tombRects[5] := tombRects[-3];
  687.                 tombRects[6] := tombRects[-5];
  688.                 numberOfStones := numberOfStones - 2;
  689.                 stonesSliding := FALSE;
  690.             end;
  691.     end;
  692.  
  693. {=================================}
  694.  
  695. end.